# -*- coding: utf-8 -*-
# created by Src - 一路好时光

#你们班有55⼈，每个⼈的姓名&考试成绩存在⼀个⼤列表⾥，格式如下：
# stu_list = [
#  ["Alex",100],
#  ["银⻆",79],
#  ["⿊姑娘",66],
#  ....
# ]
# 需求：
# 现要求按考试成绩⾼低将学员们分成5组，全存在⼀个新的⼤列表⾥, 5组分别是90-100, 80-89, 70-79,
# 60-69, 0-59
# 最终的数据格式如下：
# new_stu_list = [
#  [
#  ["Alex",100],
#  ["Rain",91],
#  ],
#  [
#  ["银⻆",79],
#  ["Jack",78],
#  ],
#  ....
#  ....
# ]

stu_list = [['李渊', 82], ['李世⺠', 7], ['侯君集', 5], ['李靖', 58], ['魏征',41], ['房⽞龄', 64], ['杜如晦', 65],
            ['柴绍', 94], ['程知节', 45], ['尉迟恭', 94],['秦琼', 54], ['⻓孙⽆忌', 85], ['李存恭', 98], ['封德彝', 16],
            ['段志⽞', 44], ['刘弘基', 18], ['徐世绩', 86], ['李治', 19], ['武则天', 39], ['太平公主', 57], ['⻙后',76],
            ['李隆基', 95], ['杨⽟环', 33], ['王勃', 49], ['陈⼦昂', 91], ['卢照邻', 70],['杨炯', 81], ['王之涣', 82],
            ['安禄⼭', 18], ['史思明', 9], ['张巡', 15], ['雷万春', 72], ['李⽩', 61], ['⾼⼒⼠', 58], ['杜甫', 27],
            ['⽩居易', 5], ['王维', 14],['孟浩然', 32], ['杜牧', 95], ['李商隐', 34], ['郭⼦仪', 53], ['张易之', 39],
            ['张昌宗', 61], ['来俊⾂', 8], ['杨国忠', 84], ['李林甫', 95], ['⾼适', 100], ['王昌龄',40], ['孙思邈', 46],
            ['⽞奘', 84], ['鉴真', 90], ['⾼骈', 85], ['狄仁杰', 62], ['⻩巢', 79], ['王仙芝', 16], ['⽂成公主', 13],
            ['松赞⼲布', 47], ['薛涛', 79], ['⻥⽞机', 16], ['贺知章', 20], ['李泌', 17], ['韩愈', 100], ['柳宗元', 88],
            ['上官婉⼉ 五代⼗国：朱温', 55], ['刘仁恭', 6], ['丁会', 26], ['李克⽤', 39], ['李存勖', 11],['葛从周',25],
            ['王建', 13], ['刘知远', 95], ['⽯敬瑭', 63], ['郭威', 28], ['柴荣', 50], ['孟昶', 17], ['荆浩', 84],
            ['刘彟', 18], ['张及之', 45], ['杜宇', 73],['⾼季兴', 39], ['喻皓', 50], ['历真', 70], ['李茂贞', 6],
            ['朱友珪', 7], ['朱友贞',11], ['刘守光', 2]]

print(stu_list)

stu_groups =[
    [],#90-100
    [],#80-89
    [],#70-79
    [],#60-69
    [],#0-59
]

for stu in stu_list:
    if stu[1]>=90:
        stu_groups[0].append(stu)
    elif stu[1]>=80:
        stu_groups[1].append(stu)
    elif stu[1]>=70:
        stu_groups[2].append(stu)
    elif stu[1]>=60:
        stu_groups[3].append(stu)
    else:
        stu_groups[4].append(stu)

print(stu_groups)
#[
# [['柴绍', 94], ['尉迟恭', 94], ['李存恭', 98], ['李隆基', 95], ['陈⼦昂', 91], ['杜牧', 95], ['李林甫', 95], ['⾼适', 100], ['鉴真', 90], ['韩愈', 100], ['刘知远', 95]],
# [['李渊', 82], ['⻓孙⽆忌', 85], ['徐世绩', 86], ['杨炯', 81], ['王之涣', 82], ['杨国忠', 84], ['⽞奘', 84], ['⾼骈', 85], ['柳宗元', 88], ['荆浩', 84]],
# [['⻙后', 76], ['卢照邻', 70], ['雷万春', 72], ['⻩巢', 79], ['薛涛', 79], ['杜宇', 73], ['历真', 70]], [['房⽞龄', 64], ['杜如晦', 65], ['李⽩', 61], ['张昌宗', 61], ['狄仁杰', 62], ['⽯敬瑭', 63]],
# [['李世⺠', 7], ['侯君集', 5], ['李靖', 58], ['魏征', 41], ['程知节', 45], ['秦琼', 54], ['封德彝', 16], ['段志⽞', 44], ['刘弘基', 18], ['李治', 19], ['武则天', 39], ['太平公主', 57], ['杨⽟环', 33], ['王勃', 49], ['安禄⼭', 18], ['史思明', 9], ['张巡', 15], ['⾼⼒⼠', 58], ['杜甫', 27], ['⽩居易', 5], ['王维', 14], ['孟浩然', 32], ['李商隐', 34], ['郭⼦仪', 53], ['张易之', 39], ['来俊⾂', 8], ['王昌龄', 40], ['孙思邈', 46], ['王仙芝', 16], ['⽂成公主', 13], ['松赞⼲布', 47], ['⻥⽞机', 16], ['贺知章', 20], ['李泌', 17], ['上官婉⼉ 五代⼗国：朱温', 55], ['刘仁恭', 6], ['丁会', 26], ['李克⽤', 39], ['李存勖', 11], ['葛从周', 25], ['王建', 13], ['郭威', 28], ['柴荣', 50], ['孟昶', 17], ['刘彟', 18], ['张及之', 45], ['⾼季兴', 39], ['喻皓', 50], ['李茂贞', 6], ['朱友珪', 7], ['朱友贞', 11], ['刘守光', 2]]
# ]

